package thread;

import java.util.Scanner;

/**
 * Sleep阻塞
 */
public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        System.out.print("请输入倒计时多少秒：");
        Scanner sc = new Scanner(System.in);
        for (int i = sc.nextInt(); i >= 0; i--) {
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
            System.out.println(i);
        }
        System.out.println("程序结束");
    }
}
